<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:75:"E:\phpstudy2016\WWW\shopsum\public/../application/admin\view\count\rmb.html";i:1520916902;s:57:"E:\phpstudy2016\WWW\shopsum\application\public\admin.html";i:1520912952;}*/ ?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>数据字典-<?php echo \think\Config::get('title'); ?></title>
    <link rel="stylesheet" href="../../../../public/static/public/boo3/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.css">
    <link rel="stylesheet" href="__PUBLIC__/index/css/sytle.css">
    <script src="__PUBLIC__/public/js/jquery-2.1.4.min.js"></script>
    <script src="__PUBLIC__/public/js/vue.min.js"></script>
    <script src="__PUBLIC__/public/js/jquery.transit.js"></script>
    <script src="__PUBLIC__/public/js/jquery.timers-1.2.js"></script>
    <script src="__PUBLIC__/public/layer-v3.1.1/layer/layer.js"></script>
    <style>
        #container{
            padding: 0 30px;
        }
        nav{
            background-color: #f5f5f5;
            padding: 10px 20px;
            z-index: 99;
            margin-bottom: 15px;
        }
        @media screen and (max-width: 800px) {
            nav{
                display: none;
            }
        }
    </style>
    <script>
        var DINDEX = '/admin/index';
        var DUSER = '/admin/user';
        var DADMIN = '/admin';
        var DJOURNALISM = '/admin/journalism';
        var DCOUNT = '/admin/count';
        //页面
        function yeMian(url,fn = 1,this_json = {title:'信息',area:['400px','450px']}) {

            var index = layer.open($.extend({type:2,content:url,end:function () {
                    if(typeof fn != 'number' ){
                        fn();
                    }
                }},this_json));
        }

        //看图
        function loock_img(url) {
            url = url.data('img');
            if((typeof url) != 'string'){
                layer.msg('没有数据查看',{icon:2});
                return;
            }
            layer.open({
                type:2,
                title:false,
                closeBtn:false,
                area:['100%','100%'],
                content:"<?php echo url('loock/index',['on'=>'true']); ?>?url="+url
            })
        }
    </script>
    
<link rel="stylesheet" href="__PUBLIC__/admin/css/index.dictionaries.css">


</head>
<body>

<nav>
       <small><i class="fa fa-institution"></i></small> 首页 > <?php echo \think\Config::get('this_user_name'); if(\think\Request::instance()->param('on') == 'true'): ?>
       <a href="javascript:;" onclick="parent.layer.close(parent.layer.getFrameIndex(window.name));"  title="关闭当前页面" class="btn btn-xs btn-default fa-pull-right " style="margin-left: 10px"><i class="fa fa-close"></i></a>
        <?php endif; ?>
    <a href="javascript:location.reload();" title="刷新" class="btn btn-xs btn-success fa-pull-right"><i class="fa fa-refresh"></i></a>
</nav>

<div id="container">


    <div class="clearfix"></div>
    <div style="height: 20px;"></div>
    <div class="table-responsive" id="header">
        <table class="table table-bordered table-hover" v-cloak>
            <thead>
            <tr class="active ">
                <th colspan="10" class="text-left">
                    <a href="javascript:;" @click="addData()" class="btn btn-info btn-sm"><i class="fa fa-plus"></i>
                        <?php echo lang('添加'); ?></a>
                    <a href="javascript:;" @click="up()" class="btn btn-success btn-sm">
                        <i class="fa fa-edit"></i> 项目资料
                    </a>
                    <span class="fa-pull-right">总 <strong>{{list.length}}</strong> 条</span>
                </th>
            </tr>
            <tr class="active">
                <th><?php echo lang('序号'); ?></th>
                <th><?php echo lang('拨付日期'); ?></th>
                <th>中标金额</th>
                <th>决算金额</th>
                <th>拨付金额</th>
                <th>欠拨金额</th>
                <th>拨款记录</th>
                <th><?php echo lang('状态'); ?></th>
                <th><?php echo lang('操作'); ?></th>
            </tr>
            </thead>
            <tbody id="tbody">
            <template v-for="(key,index) in list">
                <tr>
                    <td>{{index+1}}</td>
                    <td>{{key.time}}</td>
                    <td>
                        <a href="javascritp:;" onclick="loock_img($(this))" data-img="<?php echo $data['budgetary_price_img']; ?>"><?php echo $data['budgetary_price']; ?></a>
                    </td>
                    <td>
                        <a href="javascritp:;" onclick="loock_img($(this))" data-img="<?php echo $data['determine_mobile_img']; ?>"><?php echo $data['determine_mobile']; ?></a>
                    </td>
                    <td>{{key.money}}</td>
                    <td></td>

                    <td>
                        <a href="javascript:;" onclick="loock_img($(this))" :data-img="key.money_img"><?php echo lang('查看'); ?></a>
                    </td>
                    <td>
                        {{key.state == 0?"<?php echo lang('待审核'); ?>":key.state == 1?"<?php echo lang('通过'); ?>":"<?php echo lang('拒绝'); ?>"}}

                    </td>
                    <td>
                        <template v-if="key.state == 0 "><!--待审核-->
                            <a href="javascript:;" title="<?php echo lang('通过'); ?>" @click="upType(index,1)"><i class="fa fa-check"></i></a>
                            <a href="javascript:;" title="<?php echo lang('拒绝'); ?>" @click="upType(index,2)"><i class="fa fa-close"></i></a>
                        </template>
                        <template v-else-if="key.state == 2"> <!--拒绝-->
                            <a href="javascript:;" title="<?php echo lang('修改'); ?>" @click="up_info(index)"><i class="fa fa-edit"></i></a>
                        </template>
                        <template v-else-if="key.state == 1">
                            <a href="javascript:;" title="<?php echo lang('返回到拒绝'); ?>" @click="upType(index,2)"><i class="fa fa-mail-reply"></i></a>
                        </template>
                    </td>
                </tr>
            </template>
            </tbody>


            <!--详细-->
        </table>



    </div>
    <div class="row">
        <div class="col-xs-4">
            <?php echo lang('施工企业'); ?>：<?php echo $data['user_name']; ?><br/>
            企业法人：<?php echo $data['user_representative']; ?><br/>
            固定电话：<?php echo $data['mobile']; ?><br/>
            联系方式：<?php echo $data['user_representative_mobile']; ?>
        </div>
        <div class="col-xs-4">
            项目经理：<?php echo $data['manager']; ?><br/>
            证件号码：<?php echo $data['certificates']; ?><br/>
            联系方式：<?php echo $data['certificates_mobile1']; ?><br/>
            联系方式：<?php echo $data['certificates_mobile2']; ?>

        </div>
    </div>

</div>


</body>
</html>



<script>

    var app = new Vue({
        el: '#container',
        data: {
            list: [],
            chu:0
        }
    });

    //修改拨出错误
    app.up_info = (index)=>{
        layer.open({
            type:2,
            area:['500px','500px'],
            content:"<?php echo url('count/up_info',['on'=>'true']); ?>?id="+app.list[index].id
        })
    }
    //审核
    app.upType =(i,state)=>{
        layer.confirm("<?php echo lang('是否确定'); ?>",function () {
            $.post("<?php echo url('money_update'); ?>",{id:app.list[i].id,state:state},function (da) {
                console.log(da);
                if (da == 1) {
                    $.post("<?php echo url('count/over_sum'); ?>",{id:<?php echo \think\Request::instance()->param('id'); ?>}, function (da) {
                        app.chu = da;
                    });
                    layer.msg("<?php echo lang('成功'); ?>",{icon:1,offset:'rb'});
                }
                else{
                    layer.msg("<?php echo lang('失败'); ?>",{icon:2,offset:'rb',end:function () {
                            //location.reload();
                        }});
                }
            })
            app.list[i].state = state;
        })
    }


    get_data();

    //获取数据
    function get_data() {
        var index = layer.load(1);
        $.get("<?php echo url('count/rmb',['id'=>\think\Request::instance()->param('id')]); ?>", function (da) {
            app.list = da;
            layer.close(index);
            app.$nextTick(function(){
                var shiji_money = parseFloat('<?php echo $data['determine_mobile']; ?>') > 1 ?parseFloat('<?php echo $data['determine_mobile']; ?>'):parseFloat('<?php echo $data['budgetary_price']; ?>')
                $.each(app.list,function(i,n){
                    shiji_money = shiji_money-(app.list[i].money);
                    $('#tbody').find('tr').eq(i).find('td').eq(5).html(shiji_money.toFixed(2));
                });
            })
        });
        $.post("<?php echo url('count/over_sum'); ?>",{id:<?php echo \think\Request::instance()->param('id'); ?>}, function (da) {
            app.chu = da;
        });

    }

    //查看图片
    app.imgLock = (url)=>{
        layer.open({
            type:2,
            title:'查看文件',
            shift:'3',
            area:['100%','100%'],
            content:url
        })
    }

    app.up=()=>{
        layer.open({
            type:2,
            area:['100%','100%'],
            title:false,
            closeBtn:false,
            content:"<?php echo url('rmb_info',['on'=>'true','id'=>$data['id']]); ?>"
        })

    }



    //添加内容
    app.addData = () => {
        layer.open({
            type:2,
            area:['500px','500px'],
            content:"<?php echo url('count/add_info',['on'=>'true','id'=>$data['id']]); ?>"
        })
    }

    //完善资料
    if('<?php echo $data['user_name']; ?>' == ''){
        layer.alert('请完善项目资料',function () {
            layer.closeAll();
            app.up();
        });
    }
</script>
